﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mBlog.Extensions
{
    public static class PagerExtension
    {
        public static IEnumerable<T> AtPage<T>(this IQueryable<T> query, int? page, int itemsCount)
        {
            var items = query.Skip((page ?? 0) * itemsCount).Take(itemsCount).ToList();

            return (from item in items
                   select (T)item
                   ).ToList();
        }
    }
}
